function hfile = dmr_LoadDWI(hfile)
% DMR::LoadDWI  - load linked DWI data of a DMR into memory
%
% FORMAT:       [dmr] = dmr.LoadDWI;
%
% No input / output fields.

% Version:  v0.7b
% Build:    7083114
% Date:     Aug-31 2007, 2:02 PM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin ~= 1 || ...
    numel(hfile) ~= 1 || ...
   ~isBVQXfile(hfile, 'dmr')
    error( ...
        'BVQXfile:BadArgument', ...
        'Invalid call to %s.', ...
        mfilename ...
    );
end

% try loading the DWI
bc = bvqxfile_getcont(hfile.L);
if istransio(bc.DWIData)
    try
        bc.DWIData = bc.DWIData(:, :, :, :);
    catch
        error( ...
            'BVQXfile:transioError', ...
            'Error resolving transio access.' ...
        );
    end
    bvqxfile_setcont(hfile.L, bc);
end
